﻿using System;
using DepIC;

namespace TeF.Runner.UI.Services
{
    internal static class IoCHelper
    {
        private static IContainer _container;
        
        public static IReadOnlyContainer Container
        {
            get
            {
                if (_container == null)
                {
                    _container = ContainerFactory.Create();
                    RegisterServices(_container);
                }
                
                return _container;
            }
        }

        private static void RegisterServices(IContainer container)
        {
            if (container == null)
                throw new ArgumentNullException("container");

            container.SetConstant<ITreeViewManager, TreeViewManager>(new TreeViewManager());
        }
    }
}
